/*
 * Decompiled with CFR 0.150.
 * 
 * Could not load the following classes:
 *  javax.servlet.http.HttpServletRequest
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 *  org.springframework.beans.factory.annotation.Autowired
 *  org.springframework.web.bind.annotation.PostMapping
 *  org.springframework.web.bind.annotation.RequestBody
 *  org.springframework.web.bind.annotation.RequestMapping
 *  org.springframework.web.bind.annotation.RestController
 */
package com.gys.spliteController;

import com.gys.controller.BaseController;
import com.gys.mapper.entity.GaiaRetailPrice;
import com.gys.mapper.entity.GaiaSdSaleD;
import com.gys.mapper.entity.GaiaSdSaleH;
import com.gys.spliteService.SalesReceiptsService;
import com.gys.spliteService.data.GetCreateSaleOutData;
import com.gys.spliteService.data.GetLoginOutData;
import com.gys.spliteService.data.GetQueryProductInData;
import com.gys.spliteService.data.JsonResult;
import com.gys.spliteService.data.RecipelInfoInputData;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value={"/operation/salesReceipts/"})
public class SalesReceiptsController
extends BaseController {
    private static final Logger log = LoggerFactory.getLogger(SalesReceiptsController.class);
    @Autowired
    private SalesReceiptsService salesReceiptsService;

    @PostMapping(value={"createSale"})
    public JsonResult createSale(HttpServletRequest request, @RequestBody GetCreateSaleOutData inData) {
        this.salesReceiptsService.createSale(inData);
        return JsonResult.success("", "\u63d0\u793a\uff1a\u4fdd\u5b58\u6210\u529f\uff01");
    }

    @PostMapping(value={"getRestOrder"})
    public JsonResult getRestOrder(HttpServletRequest request, @RequestBody GaiaSdSaleH inData) {
        GetLoginOutData userInfo = this.getSpliteLoginUser();
        inData.setClientId(userInfo.getClient());
        inData.setGsshBrId(userInfo.getDepId());
        return JsonResult.success(this.salesReceiptsService.getRestOrder(inData), "\u63d0\u793a\uff1a\u83b7\u53d6\u6570\u636e\u6210\u529f\uff01");
    }

    @PostMapping(value={"getRestOrderDetail"})
    public JsonResult getRestOrderDetail(@RequestBody GaiaSdSaleD inData) {
        GetLoginOutData userInfo = this.getSpliteLoginUser();
        inData.setGssdBrId(userInfo.getDepId());
        return JsonResult.success(this.salesReceiptsService.getRestOrderDetail(inData), "\u63d0\u793a\uff1a\u83b7\u53d6\u6570\u636e\u6210\u529f\uff01");
    }

    @PostMapping(value={"saveRecipelInfo"})
    public JsonResult saveRecipelInfo(HttpServletRequest request, @RequestBody RecipelInfoInputData inData) {
        this.salesReceiptsService.saveRecipelInfo(inData);
        return JsonResult.success("", "\u63d0\u793a\uff1a\u4fdd\u5b58\u6210\u529f\uff01");
    }

    @PostMapping(value={"getStoreDyqMaxAmount"})
    public JsonResult getStoreDyqMaxAmount(HttpServletRequest request, @RequestBody GaiaRetailPrice inData) {
        GetLoginOutData userInfo = this.getSpliteLoginUser();
        inData.setClent(userInfo.getClient());
        return JsonResult.success(this.salesReceiptsService.getStoreDyqMaxAmount(inData), "\u63d0\u793a\uff1a\u83b7\u53d6\u6570\u636e\u6210\u529f\uff01");
    }

    @PostMapping(value={"queryProduct"})
    public JsonResult queryProduct(HttpServletRequest request, @RequestBody GetQueryProductInData inData) {
        GetLoginOutData userInfo = this.getSpliteLoginUser();
        inData.setClientId(userInfo.getClient());
        inData.setBrId(userInfo.getDepId());
        return JsonResult.success(this.salesReceiptsService.queryProduct(inData), "\u63d0\u793a\uff1a\u83b7\u53d6\u6570\u636e\u6210\u529f\uff01");
    }

    @PostMapping(value={"queryProductDetail"})
    public JsonResult queryProductDetail(HttpServletRequest request, @RequestBody GetQueryProductInData inData) {
        GetLoginOutData userInfo = this.getSpliteLoginUser();
        inData.setClientId(userInfo.getClient());
        inData.setBrId(userInfo.getDepId());
        return JsonResult.success(this.salesReceiptsService.queryProductDetail(inData), "\u63d0\u793a\uff1a\u83b7\u53d6\u6570\u636e\u6210\u529f\uff01");
    }

    @PostMapping(value={"queryBatchNoAndExp"})
    public JsonResult queryBatchNoAndExp(HttpServletRequest request, @RequestBody GetQueryProductInData inData) {
        GetLoginOutData userInfo = this.getSpliteLoginUser();
        inData.setClientId(userInfo.getClient());
        inData.setBrId(userInfo.getDepId());
        return JsonResult.success(this.salesReceiptsService.queryBatchNoAndExp(inData), "\u63d0\u793a\uff1a\u83b7\u53d6\u6570\u636e\u6210\u529f\uff01");
    }
}

